using System.Data;
using NHibernate;

namespace Project.Library.NHibernate
{
    public interface ITransactionManager {
        /// <summary>
        /// Creates a new transaction with the default isolation level: ReadCommited.
        /// </summary>
        /// <returns></returns>
        ITransaction CreateTransaction();

        /// <summary>
        /// Creates a new transaction with the specified isolation level.
        /// </summary>
        /// <param name="isolationLevel">The isolation level.</param>
        /// <returns></returns>
        ITransaction CreateTransaction(IsolationLevel isolationLevel);

        /// <summary>
        /// Commits the pendent operations in session.
        /// </summary>
        void Commit();

        /// <summary>
        /// Rolls the back.
        /// </summary>
        void RollBack();

        /// <summary>
        /// Sets the session.
        /// </summary>
        /// <param name="session">The session.</param>
        void SetSession(ISession session);

        /// <summary>
        /// Transactionals the flush.
        /// </summary>
        void TransactionalFlush();

        /// <summary>
        /// Transactionals the flush.
        /// </summary>
        /// <param name="isolationLevel">The isolation level.</param>
        void TransactionalFlush(IsolationLevel isolationLevel);
    }
}